<?xml version='1.0' encoding='UTF-8' ?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:fn="http://java.sun.com/jsp/jstl/functions"
                xmlns:h="http://java.sun.com/jsf/html"
                >
    <h:form class="pull-left">
        <h:outputLabel value="#{msg['delivery.customer']}" for="newCustomer" />
        <h:selectOneMenu id="newCustomer" value="#{deliveryManager.addCustomerId}">
            <c:forEach items="#{customers}" var="customer">
                <f:selectItem itemLabel="#{customer.name}" itemValue="#{customer.id}" />
            </c:forEach>
        </h:selectOneMenu>

        <h:outputLabel value="#{msg['delivery.recipientName']}" for="newRecipientName" />
        <h:inputText id="newRecipientName" value="#{deliveryManager.addRecipientName}" validator="#{deliveryValidator.validateRecipient}"/><br/>
        <h:message for="newRecipientName" errorClass="invalid" />

        <h:outputLabel value="#{msg['delivery.recipientAddress']}" for="newRecipientAddress" />
        <h:inputText id="newRecipientAddress" value="#{deliveryManager.addRecipientAddress}" validator="#{deliveryValidator.validateRecipient}"/><br/>
        <h:message for="newRecipientAddress" errorClass="invalid" />

        <h:outputLabel value="#{msg['delivery.recipientCity']}" for="newRecipientCity" />
        <h:inputText id="newRecipientCity" value="#{deliveryManager.addRecipientCity}" validator="#{deliveryValidator.validateRecipient}"/><br/>
        <h:message for="newRecipientCity" errorClass="invalid" />

        <h:outputLabel value="#{msg['delivery.recipientZip']}" for="newRecipientZip" />
        <h:inputText id="newRecipientZip" value="#{deliveryManager.addRecipientZip}" validator="#{deliveryValidator.validateRecipient}"/><br/>
        <h:message for="newRecipientZip" errorClass="invalid" />

        <h:outputLabel value="#{msg['delivery.deliveryBoy']}" for="newDeliveryBoy" />
        <h:selectOneMenu id="newDeliveryBoy" value="#{deliveryManager.addDeliveryBoyId}">
            <c:forEach items="#{deliveryBoys}" var="deliveryBoy">
                <f:selectItem itemLabel="#{deliveryBoy.name}" itemValue="#{deliveryBoy.id}" />
            </c:forEach>
        </h:selectOneMenu>
        <h:commandButton class="btn" action="#{deliveryManager.createDelivery}" value="#{msg['form.add']}" />
    </h:form>
</ui:composition>

